home *** CD-ROM | disk | FTP | other *** search
/ Know Your Hockey - The Greatest Player Resource / Know Your Hockey: The Greatest Player Resource.iso / hockey / director / ktgcst.cst / 00063_Script_ButtonKit < prev    next >
Text File  |  1998-09-28  |  8KB  |  273 lines

  1.  
  2. ------------------ Init List For Button State Tracking --------------------
  3.  
  4. -- called from on startmovie or the first exitframe script in the movie
  5. -- loads a default list of 0
  6. -- the list is used by ButtonKit to set the positions to 1 to
  7. -- track which buttons are on or off
  8.  
  9. global gButtonState,gHion,gOpning
  10.  
  11. on initButtonKit
  12.   set gButtonState = []
  13.   repeat with x = 1 to 48
  14.     append gbuttonState,0
  15.   end repeat  
  16. end
  17.  
  18. ------------------- Three State Button --------------------------------------
  19.  
  20. -- if a button has three states then call ThreeStateButton as the first line in any scripts
  21. -- that are attached to the button
  22.  
  23. on ThreeStateButton
  24.   set mybutton = the clickon
  25.   set one = getat(gbuttonState, mybutton)
  26.   if one = 0 then 
  27.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  28.     setat(gbuttonState, mybutton,2) 
  29.   end if
  30. end
  31.  
  32. -- for balls in the field
  33. on ThreeStateBall
  34.   set mybutton = the clickon
  35.   set one = getat(gbuttonState, mybutton)
  36.   if one = 0 then 
  37.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  38.     set the membernum of sprite mybutton-20 = the membernum of sprite (mybutton-20)+1
  39.     set the blend of sprite mybutton-20 = 100
  40.     setat(gbuttonState, mybutton,2)
  41.     setat(gbuttonState, (mybutton-20),2)
  42.   end if
  43. loadaudiomedia (mybutton)
  44.   updatestage
  45. end
  46.  
  47. --- for Roles
  48. on ThreeStatePlayers
  49.   set mybutton = the clickon
  50.   set one = getat(gbuttonState, mybutton)
  51.   if one = 0 then 
  52.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  53.     setat(gbuttonState, mybutton,2) 
  54.   end if
  55.   -- loadaudiomedia(mybutton)
  56. end
  57.  
  58.  
  59. --- for balls in roles where the players have threestates
  60. on ThreeStateBallR offset
  61.   set gOpning = EMPTY
  62.   set mybutton = the clickon
  63.   set one = getat(gbuttonState, mybutton)
  64.   if one = 0 then 
  65.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  66.     set player = mybutton-offset
  67.     set the membernum of sprite player = the membernum of sprite player +1
  68.     set the blend of sprite player = 100
  69.     setat(gbuttonState, mybutton,2) 
  70.     setat(gbuttonState, (player),2)
  71.   end if
  72.   loadAudioMedia(mybutton)
  73. end
  74.  
  75. on ThreeStateBallRg
  76.   set gOpning = EMPTY
  77.   set mybutton = the clickon
  78.   set one = getat(gbuttonState, mybutton)
  79.   if one = 0 then 
  80.     set the membernum of sprite mybutton = the membernum of sprite mybutton +1
  81.     setat(gbuttonState, mybutton,2) 
  82.   end if
  83.   loadAudioMedia(mybutton)
  84. end
  85.  
  86. on TwoStateField
  87.   set gOpning = EMPTY
  88.   set mybutton = the clickon+10
  89.   set one = getat(gbuttonState, mybutton)
  90.   if one = 0 then 
  91.     setat(gbuttonState, (mybutton,1)
  92.     set the membernum of sprite mybutton = the membernum of sprite mybutton+1 
  93.     set the blend of sprite mybutton = 100
  94.   end if
  95.   loadAudioMedia(mybutton)
  96. end
  97. -------------------------- Two State Buttons --------------------------
  98.  
  99. on TwoStateField2 bt
  100.   set gOpning = EMPTY
  101.   set mybutton = the clickon+bt
  102.   set one = getat(gbuttonState, mybutton)
  103.   if one = 0 then 
  104.     setat(gbuttonState, (mybutton,1)
  105.     set the membernum of sprite mybutton = the membernum of sprite mybutton+1 
  106.     set the blend of sprite mybutton = 100
  107.   end if
  108.   loadAudioMedia(mybutton)
  109. end
  110.  
  111. on TwoStateButton
  112.   set gOpning = EMPTY
  113.   set mybutton = the clickon
  114.   setat(gButtonState,mybutton,1)
  115. end
  116.  
  117.  
  118. ------------------------- Reset Button States -----------------------------------
  119.  
  120. -- toggles off any button that any ready on 
  121. -- these scripts are placed in the second line of a button handler
  122. -- after ThreeStateButton or twostatebutton
  123. -- they are divided into groups attach the correct group to you handler
  124.  
  125. on resetBalls
  126.   set mybutton = the clickon
  127.   repeat with y = 31 down to 23
  128.     set thisone = getat(gbuttonState,y)
  129.     if thisone > 0 and y <> mybutton then      
  130.             set the blend of sprite y = 0
  131.             set the blend of sprite y-20 = 0
  132.       set the membernum of sprite y = the membernum of sprite y -1
  133.       set the membernum of sprite y-20 = the membernum of sprite (y-20)-1
  134.       updatestage 
  135.       setat(gbuttonState,y,0)
  136.       setat(gbuttonState,y-20,0)
  137.       exit repeat
  138.     end if  
  139.   end repeat
  140.   
  141. end
  142.  
  143. on resetBallsR offset
  144.   set mybutton = the clickon
  145.   repeat with y = 31 down to 25
  146.     set thisone = getat(gbuttonState,y)
  147.     if thisone > 0 and y <> mybutton then 
  148.       set the blend of sprite y = 0
  149.       set the blend of sprite y-offset = 0
  150.       set the membernum of sprite y = the membernum of sprite y -1
  151.       set player = y-offset
  152.       set the membernum of sprite player = the membernum of sprite player -1
  153.       updatestage
  154.       setat(gbuttonState,y,0)
  155.       setat(gbuttonState,player,0)
  156.       exit repeat
  157.     end if
  158.   end repeat 
  159. end
  160.  
  161. on resetField
  162.   set mybutton = (the clickon)+10
  163.   repeat with y = 31 down to 25
  164.     set thisone = getat(gbuttonState,y)
  165.     if thisone > 0 and y <> mybutton then 
  166.       set the blend of sprite y = 0
  167.       set the blend of sprite y-20 = 0
  168.       set the membernum of sprite y = the membernum of sprite y-1
  169.       updatestage 
  170.       setat(gbuttonState,y,0)
  171.       setat(gbuttonState,y-20,0)
  172.       exit repeat
  173.     end if
  174.   end repeat 
  175. end
  176.  
  177. on resetField2 bt
  178.   set mybutton = (the clickon)+bt--for the edges in field defence
  179.   repeat with y = 31 down to 25
  180.     set thisone = getat(gbuttonState,y)
  181.     if thisone > 0 and y <> mybutton then 
  182.       set the blend of sprite y = 0
  183.       set the blend of sprite y-20 = 0
  184.       set the membernum of sprite y = the membernum of sprite y-1
  185.       updatestage 
  186.       setat(gbuttonState,y,0)
  187.       setat(gbuttonState,y-20,0)
  188.       exit repeat
  189.     end if
  190.   end repeat 
  191. end
  192. --- attach to buttons
  193. on resetsweater
  194.   set mybutton = the clickon
  195.   repeat with y = 38 down to 34
  196.     set thisone = getat(gbuttonState,y)
  197.     if thisone > 0 and y <> mybutton then 
  198.       set the blend of sprite y = 0
  199.       set the membernum of sprite y = the membernum of sprite y -1
  200.       updatestage
  201.       setat(gbuttonState,y,0)
  202.       exit repeat
  203.     end if
  204.   end repeat
  205. end
  206.  
  207. on resetbanner
  208.   set mybutton = the clickon
  209.   repeat with y = 47 down to 39
  210.     set thisone = getat(gbuttonState,y)
  211.     if thisone > 0 and y <> mybutton then 
  212.       set the blend of sprite y = 0
  213.       set the membernum of sprite y = the membernum of sprite y -1
  214.       updatestage
  215.       setat(gbuttonState,y,0)
  216.       exit repeat
  217.     end if
  218.   end repeat 
  219. end
  220.  
  221. on resetbannerAlt b -- alternate to mouseup script in rules
  222.   global gRbook
  223.   case gRBook of
  224.     "soccer":
  225.       set mybutton = 40
  226.     "micro":
  227.       set mybutton = b
  228.   end case
  229.   
  230.   put mybutton
  231.   repeat with y = 47 down to 39
  232.     set thisone = getat(gbuttonState,y)
  233.     if thisone > 0 and y <> mybutton then 
  234.       set the blend of sprite y = 0
  235.       set the membernum of sprite y = the membernum of sprite y -1
  236.       setat(gbuttonState,y,0)
  237.       exit repeat
  238.     end if
  239.   end repeat 
  240.   updatestage
  241. end
  242.  
  243. -- for rules
  244. on resettabs1
  245.   set mybutton = the clickon
  246.   put mybutton
  247.   repeat with y = 33 down to 30
  248.     set thisone = getat(gbuttonState,y)
  249.     if thisone > 0 and y <> mybutton then 
  250.       set the blend of sprite y = 0
  251.       setat(gbuttonState,y,0)
  252.       exit repeat
  253.     end if
  254.   end repeat 
  255.   updatestage
  256. end
  257.  
  258. on resettabs2
  259.   set mybutton = the clickon
  260.   put mybutton
  261.   repeat with y = 37 down to 34
  262.     set thisone = getat(gbuttonState,y)
  263.     if thisone > 0 and y <> mybutton then 
  264.       set the blend of sprite y = 0
  265.       setat(gbuttonState,y,0)
  266.       exit repeat
  267.     end if
  268.   end repeat 
  269.   updatestage
  270. end
  271.  
  272.  
  273.